#![crate_type = "dylib"]
use base64::prelude::*;

#[no_mangle]
pub extern "C" fn base64_decode(text:&str) -> String {
    BASE64_STANDARD.encode(text)
}

#[no_mangle]
pub extern "C" fn base64_encode(text:&str) -> String{
    let r = BASE64_STANDARD.decode(text);
    match r {
        Ok(r) => {
            String::from_utf8(r).unwrap()
        }
        Err(_) => {
            text.to_string()
        }
    }
}

